/**
 * 把 HTTP 协议的 avatar url 转为 HTTPS 的
 */
function makeHTTPSAvatar(url: null | undefined): null
function makeHTTPSAvatar(url: string): string
function makeHTTPSAvatar(url: string | null | undefined) {
  if (url === null || url === undefined) return null
  const httpsAvailableDomains = ['wx.qlogo.cn']
  for (const domain of httpsAvailableDomains) {
    const match = `http://${domain}/`
    if (url.startsWith(match)) return 'https' + url.slice(4)
  }
  return url
}
export { makeHTTPSAvatar }
